package org.example.physics_engine.collision.detector;

import javafx.util.Pair;
import org.example.physics_engine.collision.CollisionFilter;
import org.example.physics_engine.collision.contact.ContactConstraint;
import org.example.physics_engine.collision.SequentialImpulses;
import org.example.physics_engine.collision.manifold.Manifold;
import org.example.physics_engine.body.PhysicsBody;
import org.example.physics_engine.geometry.Vector2d;

import java.util.List;

public interface CollisionDetector {
    //根据物体列表执行narrowPhase的碰撞检测并获得碰撞流形
    List<Pair<Manifold, Pair<PhysicsBody, PhysicsBody>>> detect(List<PhysicsBody> bodies1, List<PhysicsBody> bodies2, List<CollisionFilter> filters);

    //本地求解前使用碰撞流形计算出接触约束
    List<ContactConstraint> preLocalSolve(List<Pair<Manifold, Pair<PhysicsBody, PhysicsBody>>> manifolds);

    //本地求解接触约束
    void LocalSolve(SequentialImpulses solver, Vector2d gravity, List<ContactConstraint> constraints, List<PhysicsBody> bodies);

}
